Foreign Key Problem
От | Lola Lee |
---|---|
Тема | Foreign Key Problem |
Дата | |
Msg-id | p06020403bc1284a8e630@[192.168.2.103] обсуждение исходный текст |
Ответы |
Re: Foreign Key Problem
|
Список | pgsql-novice |
I'm using PostgreSQL 7.4, and I have two tables, which I created as follows: CREATE TABLE needlestyle ( needle_style_id SERIAL, needle_style_desc varchar(50) NULL, needle_style_lud timestamp NULL, PRIMARY KEY (needle_style_id) ); CREATE TABLE needles ( needles_id SERIAL, needle_style_id int NULL, needle_mm decimal(5,2) NULL, needle_length varchar(20) NULL, needle_lud timestamp NULL, PRIMARY KEY (needles_id), FOREIGN KEY (needles_id) REFERENCES accessory, FOREIGN KEY (needle_style_id) REFERENCES needlestyle ); I filled the needlestyle table with three records. Then I tried to run the following insert via phpPgAdmin and got the following error message: ERROR: insert or update on table "needles" violates foreign key constraint "$1" In statement: INSERT INTO "needles" ("needles_id", "needle_style_id", "needle_mm", "needle_length", "needle_lud") VALUES (nextval('public.needles_needles_id_seq'::text), '1', '2.25', '24"', NULL) What could be the problem? -- Lola - mailto:lola@his.com http://www.lolajl.net | Blog at http://www.lolajl.net/blog/ Check out this blog: http://www.denbeste.nu I'm in Bowie, MD, USA, halfway between DC and Annapolis.
В списке pgsql-novice по дате отправления: